home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstSetCirc.c,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  1.8 KB  |  91 lines

  1. head     1.3;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.3
  10. date     88.11.17.20.54.04;  author adam;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.3
  21. log
  22. @checked in with -k by kupfer at 92.05.18.17.32.47.
  23. @
  24. text
  25. @/*-
  26.  * listSetCirc.c --
  27.  *    Change the library's notion of the circularity of a list.
  28.  *
  29.  * Copyright (c) 1988 by the Regents of the University of California
  30.  *
  31.  * Copyright (c) 1988 by Adam de Boor
  32.  *
  33.  * Permission to use, copy, modify, and distribute this
  34.  * software and its documentation for any purpose and without
  35.  * fee is hereby granted, provided that the above copyright
  36.  * notice appears in all copies.  The University of California nor
  37.  * Adam de Boor makes any representations about the suitability of this
  38.  * software for any purpose.  It is provided "as is" without
  39.  * express or implied warranty.
  40.  *
  41.  *
  42.  */
  43. #ifndef lint
  44. static char *rcsid =
  45. "$Id: lstSetCirc.c,v 1.3 88/11/17 20:54:04 adam Exp $ SPRITE (Berkeley)";
  46. #endif lint
  47.  
  48. #include    "lstInt.h"
  49.  
  50. /*
  51.  *------------------------------------------------------------
  52.  * Lst_SetCirc --
  53.  *    change the circularity of a list
  54.  *
  55.  * Results:
  56.  *    none
  57.  *
  58.  * Side Effects:
  59.  *    The circularity of the list is set appropriately. The head and
  60.  *    tail of the list will be linked or unlinked as necessary
  61.  *------------------------------------------------------------
  62.  */
  63. void
  64. Lst_SetCirc (l, circ)
  65.     Lst              l;
  66.     Boolean      circ;
  67. {
  68.     register List list = (List) l;
  69.  
  70.     /*
  71.      * if this isn't a change, do nothing.
  72.      */
  73.     if ((list->isCirc && circ) || (!list->isCirc && !circ)) {
  74.     return;
  75.     }
  76.     list->isCirc = circ;
  77.     
  78.     if (LstIsEmpty (l)) {
  79.     return;
  80.     }
  81.     
  82.     if (circ) {
  83.     list->firstPtr->prevPtr = list->lastPtr;
  84.     list->lastPtr->nextPtr = list->firstPtr;
  85.     } else {
  86.     list->firstPtr->prevPtr = NilListNode;
  87.     list->lastPtr->nextPtr = NilListNode;
  88.     }
  89. }
  90. @
  91.